<template>
	<view class="usecoupon">
		<!-- 		copy search页 -->
		<view class="search-top" :class="{searchintop : scrollTop > 0}">
			<view class="search-top-left">
				<text style="font-size: 32rpx; margin-right: 10rpx;">全国</text>
				<image src="../static/search/down.png" style="width: 24rpx; height: 18rpx;"></image>
			</view>
			<view class="search-top-middle">
				<view class="search-top-middle-part">
					<view class="search-top-middle-part-icon">
						<image src="../static/search/search-grey.png" style="width: 54rpx; height: 54rpx;"></image>
					</view>
					<view class="search-top-middle-part-input">
						<input style="width: 100%; height: 100%; font-size: 28rpx;" focus placeholder="想租什么,搜一搜" />
					</view>
				</view>
			</view>
			<view class="search-top-right">
				<view class="search-top-right-button">
					<text style="font-size: 32rpx; font-weight: bold;">搜索</text>
				</view>
			</view>
		</view>
		<!-- 		copy search页 -->
		<!-- 		copy receiving页 -->
		<view class="usecoupon-coupon">
			<view class="receiving-part">
				<view class="receiving-part-left">
					<view class="receiving-part-left-text">
						<text style="font-size: 36rpx; font-weight: 600; color: white;">首月租金5折</text>
					</view>
				</view>
				<view class="receiving-part-right">
					<view class="receiving-part-right-top">
						<view class="receiving-part-right-top-left">
							<view class="receiving-part-right-top-left-connet">
								<text style="font-size: 24rpx; color: white;">固定折扣卷</text>
							</view>
						</view>
						<text style="font-size: 24rpx;">可用于全部商城</text>
					</view>
					<view class="receiving-part-right-bottom">
						<text
							style="margin-left: 10rpx; font-size: 24rpx; line-height: 80rpx; display: block;">可参与首月租金抵扣</text>
						<text
							style="margin-left: 10rpx; font-size: 24rpx; line-height: 80rpx; display: block;">领取后1天有效</text>
						<view class="receiving-buttom">
							<text style="color: #ffffff;font-size: 28rpx;">已领取</text>
						</view>
					</view>

				</view>
			</view>
		</view>
		<!-- 		copy receiving页 -->
		<view class="usecoupon-goods">
			<view class="usecoupon-goods-part">
				<view class="usecoupon-goods-part-list" v-for="(item,index) in goods" :key="index">
					<view class="hot-part" @click="ToGoods(item.id)">
						<GoodsList>
							<template #img>
								<image :src="imgURL2 + item.imgurl" mode="widthFix" style="width: 72%; height: 80%;">
								</image>
							</template>
							<template #title>
								<text>{{item.extension_title}}</text>
							</template>
							<template #value>
								<text>{{item.min_price}}</text>
							</template>
							<template #qvan>
								<view class="goods-connet-value-right" v-show="item.dayRent_new">
									<view class="goods-connet-value-right-text">
										<text>券后￥</text>
										<text style="font-size: 24rpx;">{{item.dayRent_new}}</text>
										<text>/天</text>
									</view>
								</view>
							</template>
							<template #activity_title>
								<text>{{item.activity_title}}</text>
							</template>
							<template #label>
								<view class="goods-connet-tips-part">
									<view class="goods-connet-tips-list" style="margin-left: 0rpx;"
										v-show="(item.rent_label).indexOf('包邮') != -1">
										<text>包邮</text>
									</view>
									<view class="goods-connet-tips-list"
										style="width: 100rpx; background-color: #ffedee; color: red;"
										v-show="(item.rent_label).indexOf('可买断') != -1">
										<text>可买断</text>
									</view>
									<view class="goods-connet-tips-list" style=" background-color: #ffedee; color: red;"
										v-show="(item.rent_label).indexOf('全新') != -1">
										<text>全新</text>
									</view>
								</view>
							</template>
						</GoodsList>
					</view>
				</view>

			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				scrollTop: '',
				i: 1,
				goods: [],
				imgURL: this.imgURL,
				imgURL2: this.imgURL2,
			}
		},
		onLoad() {
			uni.request({
				url: this.$apiUrl + 'Centre/indexList',
				method: 'GET',
				data: {
					page: this.i,
					pageSize: 10
				},
				complete: (res) => {
					this.i++
					this.goods = [...this.goods, ...res.data.data.data]
					// console.log(this.goods)
					// console.log(this.i)
				}
			})
		},
		onReachBottom() {
			uni.request({
				url: this.$apiUrl + 'Centre/indexList',
				method: 'GET',
				data: {
					page: this.i,
					pageSize: 10
				},
				complete: (res) => {
					this.i++
					this.goods = [...this.goods, ...res.data.data.data]
					// console.log(this.goods)
					// console.log(this.i)
				}
			})
		},
		methods: {}
	}
</script>

<style>
	page {
		width: 100%;
		height: 100%;
		background-color: #FFFFFF;
	}

	.usecoupon {
		width: 100%;
		height: 100%;
	}

	.search-top {
		width: 100%;
		height: 90rpx;
		display: flex;
		justify-content: center;
		/* 		transition: top 0.1s; */
		/* 		position: absolute;
		top:0rpx;
		background-color: white; */
	}

	.searchintop {
		position: fixed;
		/* 		top:0rpx; */
		background-color: white;
		z-index: 99;
	}

	.search-top-left {
		width: 20%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.search-top-middle {
		width: 60%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.search-top-middle-part {
		width: 96%;
		height: 60%;
		background-color: #f8f8f8;
		border-radius: 32rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.search-top-middle-part-icon {
		width: 14%;
		height: 90%;
		margin-left: 2%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.search-top-middle-part-input {
		width: 80%;
		height: 90%;
	}

	.search-top-right {
		width: 20%;
		height: 100%;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.search-top-right-button {
		width: 120rpx;
		height: 54rpx;
		background-color: red;
		color: white;
		display: flex;
		justify-content: center;
		align-items: flex-start;
		border-radius: 32rpx;
	}

	.receiving-part {
		margin-top: 20rpx;
		width: 90%;
		height: 240rpx;
		display: flex;
		justify-content: space-around;
		background-color: white;
		border-radius: 12rpx 0 0 12rpx;
		box-shadow: 0 2px 4px rgba(0, 0, 0, .12), 0 0 6px rgba(0, 0, 0, .04);
	}

	.receiving-part-left {
		width: 38%;
		height: 100%;
		background-color: red;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 12rpx 0 0 12rpx;
	}

	.receiving-part-right {
		width: 60%;
		height: 100%;
	}

	.receiving-part-right-top {
		height: 33%;
		width: 100%;
		display: flex;
		align-items: center;
		justify-content: left;
	}

	.receiving-part-right-top-left {
		width: 50%;
		height: 60rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.receiving-part-right-top-left-connet {
		width: 92%;
		height: 88%;
		background-color: red;
		display: flex;
		justify-content: center;
		align-items: center;
		border-radius: 12rpx;
	}

	.receiving-part-right-bottom {
		width: 100%;
		height: 67%;
	}

	.receiving-buttom {
		position: relative;
		bottom: 80rpx;
		background-color: #c1c1c1;
		color: white;
		left: 220rpx;
		width: 36%;
		height: 64rpx;
		border-radius: 24rpx;
		display: flex;
		justify-content: center;
		align-items: center;
	}

	.usecoupon-coupon {
		width: 100%;
		height: 300rpx;
		display: flex;
		justify-content: center;
		align-items: center;
		background-color: #FFFFFF;
	}

	.usecoupon-goods {
		width: 100%;
		background-color: #f8f8f8;
		display: flex;
		justify-content: center;
	}

	.usecoupon-goods-part {
		width: 90%;
		display: flex;
		justify-content: space-between;
		flex-wrap: wrap;
		margin-top: 15px;

	}

	.usecoupon-goods-part-list {
		width: 48%;
		height: 520rpx;
		background-color: white;
		margin-bottom: 20rpx;
		border-radius: 12rpx;
		box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1)
	}
</style>
